package com.jysz.certificate.persistence.model.workflow;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Type;

import com.jysz.webcore.ssh.entity.AbstractBaseEntity;

/**
 * 流程关联对象
 * @author xuxiaolong
 */
@Entity
@Table(name = "wf_object_")
@org.hibernate.annotations.Entity
public class WorkflowObject extends AbstractBaseEntity<Long> {

	private static final long serialVersionUID = -8320685897547643089L;

	/** 所属流程*/
	private Workflow workflow;
	
	/** 对象ID*/
	private Long objectId;

	public WorkflowObject(){};
	public WorkflowObject(Workflow workflow,Long objectId){
		this.workflow=workflow;
		this.objectId=objectId;
	};
	@ManyToOne(cascade = CascadeType.REFRESH,fetch = FetchType.LAZY)  
	@JoinColumn(name = "_workflow_id", insertable=true, updatable=true,columnDefinition="bigint(20)")
	@Type(type = "Long")
	public Workflow getWorkflow() {
		return workflow;
	}

	public void setWorkflow(Workflow workflow) {
		this.workflow = workflow;
	}

	@Column(name = "_object_id", nullable = false,columnDefinition="bigint(20)")
	public Long getObjectId() {
		return objectId;
	}

	public void setObjectId(Long objectId) {
		this.objectId = objectId;
	}
	
	
	
}
